﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TemplateWizard;

namespace SecurableWebFormWizard
{
    public class GridWizard : IWizard
    {
        public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
        {

        }

        public void ProjectFinishedGenerating(EnvDTE.Project project)
        {

        }

        public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
        {

        }

        public void RunFinished()
        {

        }

        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            //  Create the form.
            GridSettingsForm form = new GridSettingsForm();

            //  Show the form.
            form.ShowDialog();

            //  Add the options to the replacementsDictionary.
            replacementsDictionary.Add("$PageTitle$", form.PageTitle);
            replacementsDictionary.Add("$PanelTitle$", form.PanelTitle);
            replacementsDictionary.Add("$GridName$", form.GridName);
            replacementsDictionary.Add("$SearchType$", form.Searching);
            replacementsDictionary.Add("$SelectionType$", form.Selection);

            replacementsDictionary.Add("$AuthorizableItemGuid$", Guid.NewGuid().ToString());
        }

        public bool ShouldAddProjectItem(string filePath)
        {
            return true;
        }
    }
}
